local RunService = game:GetService("RunService") local function create(class: string, properties: {[string]: any}, parent: Instance?) local inst = Instance.new(class) for k, v in properties do inst[k] = v end inst.Parent = parent return inst end local rolling = false local wheel local visualWheel, visualFX local humanoid local motor, sidewaysFriction, antigravity local trails = {} local hitPlayers = {} local gui = create("ScreenGui", { ResetOnSpawn = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling }, owner.PlayerGui) local remoteToggleRolling = create("RemoteEvent", { Name = "ToggleRolling" }, gui) local function setInvisible(inst: BasePart & Decal, invisible: boolean) if invisible and not inst:GetAttribute("Invisible") then inst:SetAttribute("Invisible", true) inst:SetAttribute("OriginalTransparency", inst.Transparency) inst.Transparency = 1 elseif not invisible and inst:GetAttribute("Invisible") then inst.Transparency = inst:GetAttribute("OriginalTransparency") or 0 inst:SetAttribute("OriginalTransparency", nil) inst:SetAttribute("Invisible", nil) end end local function setRolling(isRolling) if not humanoid then return end rolling = isRolling local root = owner.Character:FindFirstChild("HumanoidRootPart") local velocity = root.AssemblyLinearVelocity wheel.CFrame = root and root.CFrame or wheel.CFrame wheel.Parent = isRolling and owner.Character or nil wheel:ApplyImpulse(-wheel.AssemblyLinearVelocity * wheel.AssemblyMass) wheel:ApplyImpulse(velocity * wheel.AssemblyMass) visualWheel.Parent = wheel.Parent visualFX.Parent = wheel.Parent owner.Character:SetAttribute("Rolling", isRolling) for _, part in owner.Character:GetDescendants() do if part:IsA("BasePart") and not (part.Name == "HumanoidRootPart") and not part:IsDescendantOf(visualWheel) then if part == wheel then part.Massless = not isRolling setInvisible(part, not isRolling) else part.Massless = isRolling setInvisible(part, isRolling) end elseif part:IsA("Decal") then setInvisible(part, isRolling) end end motor.MaxForce = 80 * wheel.AssemblyMass sidewaysFriction.MaxForce = motor.MaxForce * 2 humanoid.PlatformStand = isRolling if not isRolling then end end local function onWheelTouched(other) if other:IsDescendantOf(owner.Character) then return end local human = other.Parent and other.Parent:FindFirstChildOfClass("Humanoid") if human and not hitPlayers[human] then hitPlayers[human] = true local damage = (wheel.AssemblyLinearVelocity.Magnitude - 20)*1.5 if damage > 0 then human:TakeDamage(damage) if damage > 30 then human.Sit = true end end task.wait(0.5) hitPlayers[human] = nil end end local function onCharacterAdded(character) rolling = false humanoid = character:FindFirstChildOfClass("Humanoid") while not humanoid do character.ChildAdded:Wait() humanoid = character:FindFirstChildOfClass("Humanoid") end local rootPart = character:WaitForChild("HumanoidRootPart") humanoid.WalkSpeed = 24 wheel = create("Part", { Name = "Wheel", Shape = Enum.PartType.Ball, Size = Vector3.new(4, 4, 4), Transparency = 1, RootPriority = -10 }) visualWheel = create("Model", { Name = "VisualWheel" }) visualFX = create("Part", { CanCollide = false, CanTouch = false, CanQuery = false, Transparency = 1, Size = Vector3.one, Name = "VisualFX" }) local visualRoot = create("Part", { Shape = Enum.PartType.Cylinder, Size = Vector3.new(2.25, 4, 4), Color = BrickColor.new("Black").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) visualWheel.PrimaryPart = visualRoot local center0 = create("Part", { Shape = Enum.PartType.Cylinder, Size = Vector3.new(2.5, 3.125, 3.125), Color = BrickColor.new("Medium stone grey").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) local center1 = create("Part", { Shape = Enum.PartType.Cylinder, Size = Vector3.new(2.501, 3, 3), Color = BrickColor.new("Black").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) local center2 = create("Part", { Shape = Enum.PartType.Cylinder, Size = Vector3.new(2.502, 2.5, 2.5), Color = Color3.new(0, 0.65, 1), Material = Enum.Material.Neon, CanCollide = false }, visualWheel) local center3 = create("Part", { Shape = Enum.PartType.Cylinder, Size = Vector3.new(2.504, 2.25, 2.25), Color = BrickColor.new("Black").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) local center4 = create("Part", { Size = Vector3.new(2.503, 2.5, 0.5), Color = BrickColor.new("Black").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) local center5 = create("Part", { Size = Vector3.new(2.503, 0.5, 2.5), Color = BrickColor.new("Black").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) create("WeldConstraint", {Part0 = center0, Part1 = center1}, center1) create("WeldConstraint", {Part0 = center1, Part1 = visualRoot}, center1) create("WeldConstraint", {Part0 = center2, Part1 = center1}, center2) create("WeldConstraint", {Part0 = center3, Part1 = center2}, center3) create("WeldConstraint", {Part0 = center4, Part1 = center3}, center4) create("WeldConstraint", {Part0 = center5, Part1 = center3}, center5) for i = 1, 12 do local p = create("Part", { CFrame = CFrame.Angles((i - 1)/12*math.pi*2, 0, 0) * CFrame.new(0, 2, 0) * CFrame.Angles(math.rad(-10), 0, 0), Size = Vector3.new(2, 0.25, 1.25), Color = BrickColor.new("White").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) local c1 = create("Part", { CFrame = p.CFrame*CFrame.new(-0.5, 0, 0), Size = Vector3.new(0.25, 0.251, 1.251), Color = Color3.new(0, 0.65, 1), Material = Enum.Material.Neon, CanCollide = false }, visualWheel) local c2 = create("Part", { CFrame = p.CFrame*CFrame.new(0.5, 0, 0), Size = Vector3.new(0.25, 0.251, 1.251), Color = Color3.new(0, 0.65, 1), Material = Enum.Material.Neon, CanCollide = false }, visualWheel) local l = create("Part", { CFrame = p.CFrame * CFrame.new(-1, 0.125, 0) * CFrame.Angles(0, 0, math.rad(15)) * CFrame.new(-0.125, -0.125, 0), Size = Vector3.new(0.25, 0.25, 1.25), Color = BrickColor.new("White").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) local r = create("Part", { CFrame = p.CFrame * CFrame.new(1, 0.125, 0) * CFrame.Angles(0, 0, math.rad(-15)) * CFrame.new(0.125, -0.125, 0), Size = Vector3.new(0.25, 0.25, 1.25), Color = BrickColor.new("White").Color, Material = Enum.Material.SmoothPlastic, CanCollide = false }, visualWheel) create("WeldConstraint", {Part0 = p, Part1 = visualRoot}, p) create("WeldConstraint", {Part0 = c1, Part1 = l}, p) create("WeldConstraint", {Part0 = c2, Part1 = l}, p) create("WeldConstraint", {Part0 = p, Part1 = l}, p) create("WeldConstraint", {Part0 = p, Part1 = r}, p) end local visualAttachment0 = create("Attachment", { Axis = Vector3.zAxis }, visualRoot) local visualAttachment1 = create("Attachment", {}, rootPart) local visualAttachment2 = create("Attachment", {}, visualFX) create("AlignPosition", { Attachment0 = visualAttachment0, Attachment1 = visualAttachment1, RigidityEnabled = true }, visualWheel) create("AlignOrientation", { Attachment0 = visualAttachment0, Mode = Enum.OrientationAlignmentMode.OneAttachment, RigidityEnabled = true }, visualWheel) create("AlignPosition", { Attachment0 = visualAttachment2, Attachment1 = visualAttachment1, RigidityEnabled = true }, visualFX) create("AlignOrientation", { Attachment0 = visualAttachment2, Mode = Enum.OrientationAlignmentMode.OneAttachment, RigidityEnabled = true }, visualFX) local TrailAttLB = create("Attachment", {CFrame = CFrame.new(-0.5, -2, 0)}, visualFX) local TrailAttRB = create("Attachment", {CFrame = CFrame.new(0.5, -2, 0)}, visualFX) local TrailAttLT = create("Attachment", {CFrame = CFrame.new(-0.5, 2, 0)}, visualFX) local TrailAttRT = create("Attachment", {CFrame = CFrame.new(0.5, 2, 0)}, visualFX) trails = { create("Trail", { Color = ColorSequence.new(Color3.new(0, 0.75, 1)), Transparency = NumberSequence.new(0.5, 1), LightInfluence = 0, LightEmission = 1, Lifetime = 0.5, Attachment0 = TrailAttLB, Attachment1 = TrailAttLT }, visualFX), create("Trail", { Color = ColorSequence.new(Color3.new(0, 0.75, 1)), Transparency = NumberSequence.new(0.5, 1), LightInfluence = 0, LightEmission = 1, Lifetime = 0.5, Attachment0 = TrailAttRB, Attachment1 = TrailAttRT }, visualFX), } create("Weld", { Part0 = rootPart, Part1 = wheel }, wheel) local wheelAttachment1 = create("Attachment", {}, wheel) antigravity = create("VectorForce", { Name = "Antigravity", Attachment0 = wheelAttachment1, ApplyAtCenterOfMass = true, RelativeTo = Enum.ActuatorRelativeTo.World, Force = Vector3.zero }, wheel) motor = create("LinearVelocity", { Name = "RollMotor", Attachment0 = wheelAttachment1, RelativeTo = Enum.ActuatorRelativeTo.World, VelocityConstraintMode = Enum.VelocityConstraintMode.Line, LineVelocity = 0 }, wheel) sidewaysFriction = create("LinearVelocity", { Name = "SideFriction", Attachment0 = wheelAttachment1, RelativeTo = Enum.ActuatorRelativeTo.World, VelocityConstraintMode = Enum.VelocityConstraintMode.Line, LineVelocity = 0 }, wheel) wheel.Touched:Connect(onWheelTouched) end onCharacterAdded(owner.Character) owner.CharacterAdded:Connect(onCharacterAdded) RunService.Heartbeat:Connect(function(dt) if not antigravity then return end local character = owner.Character if not character then return end local root = character:FindFirstChild("HumanoidRootPart") if not root then return end end) remoteToggleRolling.OnServerEvent:Connect(function(player) if player ~= owner then return end setRolling(not rolling) end) NLS([=[local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local playerConns = {} local lastDirection = Vector3.new() local jumpNormal = Vector3.yAxis local moveVector = Vector3.new() local up, right, down, left = false, false, false, false local coyote = 0 local stickTimer = 0 local gravityNormal = -Vector3.yAxis local gui = script.Parent local bottomBar = Instance.new("Frame") bottomBar.Position = UDim2.fromScale(0.5, 1) bottomBar.Size = UDim2.fromScale(0.75, 0.1) bottomBar.SizeConstraint = Enum.SizeConstraint.RelativeYY bottomBar.AnchorPoint = Vector2.new(0.5, 1) bottomBar.BackgroundColor3 = BrickColor.new("White").Color bottomBar.BorderSizePixel = 0 bottomBar.Parent = gui local speedLabel = Instance.new("TextLabel") speedLabel.Size = UDim2.fromScale(0.5, 1) speedLabel.Position = UDim2.new() speedLabel.TextColor3 = Color3.fromRGB(90, 90, 90) speedLabel.TextScaled = true speedLabel.FontFace = Font.fromId(12187365977, Enum.FontWeight.Heavy) speedLabel.BackgroundTransparency = 1 speedLabel.Text = "SPEED" speedLabel.Parent = bottomBar local speedText = Instance.new("TextLabel") speedText.Size = UDim2.new(0.5, -16, 1, -16) speedText.Position = UDim2.new(0.5, 8, 0, 8) speedText.BackgroundColor3 = BrickColor.new("Black").Color speedText.TextColor3 = Color3.new(0, 0.75, 1) speedText.TextScaled = true speedText.FontFace = Font.fromId(12187371840, Enum.FontWeight.Regular) speedText.Parent = bottomBar local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0.5, 0) corner.Parent = speedText local remoteToggleRolling = gui:WaitForChild("ToggleRolling") local rcParams = RaycastParams.new() rcParams.FilterType = Enum.RaycastFilterType.Exclude rcParams.IgnoreWater = true rcParams.RespectCanCollide = true local rayDirections = table.create(128) do local phi = math.pi * (3 - math.sqrt(5)) for i = 0, 127 do local y = 1 - (i / 127) * 2 local radius = math.sqrt(1 - y * y) local theta = phi * i rayDirections[i+1] = Vector3.new( math.cos(theta) * radius, y, math.sin(theta) * radius ) end end local function twistAngle(cf, direction) local axis, theta = cf:ToAxisAngle() local w, v = math.cos(theta/2), math.sin(theta/2)*axis local proj = v:Dot(direction)*direction local twist = CFrame.new(0, 0, 0, proj.x, proj.y, proj.z, w) local nAxis, nTheta = twist:ToAxisAngle() return math.sign(v:Dot(direction))*select(2, twist:ToAxisAngle()) end local function updateMoveVector() local x, z = 0, 0 if up then z = z - 1 end if down then z = z + 1 end if left then x = x - 1 end if right then x = x + 1 end moveVector = Vector3.new(x, 0, z) if moveVector.Magnitude > 1 then moveVector = moveVector.Unit end end local function processRolling(character, t, dt) local wheel = character:FindFirstChild("Wheel") if not wheel then return end local motor = wheel:FindFirstChild("RollMotor") local sideFriction = wheel:FindFirstChild("SideFriction") if not motor or not sideFriction then return end local up = -gravityNormal local cameraCF = workspace.CurrentCamera.CFrame local cameraLook = cameraCF.LookVector local yaw = math.atan2(cameraLook.X, cameraLook.Z) local pitch = -math.asin(gravityNormal.Y) --[[ motor.PlaneVelocity = Vector2.new(moveVector.X, moveVector.Z) * 60 motor.PrimaryTangentAxis = (cameraCF.XVector - up*up:Dot(cameraCF.XVector)).Unit motor.SecondaryTangentAxis = (cameraCF.ZVector - up*up:Dot(cameraCF.ZVector)).Unit ]] if moveVector.Magnitude >= 0.01 then local cf = CFrame.Angles(0, yaw, 0) * CFrame.Angles(pitch, 0, 0) motor.LineVelocity = moveVector.Magnitude * 120 --[[ motor.LineDirection = ( (cameraCF.ZVector - up*up:Dot(cameraCF.ZVector)).Unit*moveVector.Z + (cameraCF.XVector - up*up:Dot(cameraCF.XVector)).Unit*moveVector.X ) sideFriction.LineDirection = ( (cameraCF.ZVector - up*up:Dot(cameraCF.ZVector)).Unit*moveVector.X + (cameraCF.XVector - up*up:Dot(cameraCF.XVector)).Unit*-moveVector.Z ) ]] motor.LineDirection = cf:VectorToWorldSpace(Vector3.new(-moveVector.X, -moveVector.Z, 0)) sideFriction.LineDirection = motor.LineDirection:Cross(up) else motor.LineVelocity = 0 end end RunService.Stepped:Connect(function(t, dt) local character = game.Players.LocalPlayer.Character if not character then return end if character:GetAttribute("Rolling") then processRolling(character, t, dt) end end) RunService.Heartbeat:Connect(function(dt) coyote = coyote - dt local character = game.Players.LocalPlayer.Character if not character then return end local root = character:FindFirstChild("HumanoidRootPart") if root then local speed = math.round(math.min(root.AssemblyLinearVelocity.Magnitude, 999)) speedText.Text = string.format("%03i", speed) else speedText.Text = "---" end if character:GetAttribute("Rolling") and root then local totalNormal = Vector3.zero if root then for _, d in pairs(rayDirections) do local result = workspace:Raycast(root.Position, d * 2.1, rcParams) if result then totalNormal = totalNormal + result.Normal end end if totalNormal.Magnitude > 0 then totalNormal = totalNormal.Unit coyote = 0.2 jumpNormal = totalNormal end end if totalNormal.Magnitude > 0 and root and root.AssemblyLinearVelocity.Magnitude >= 30 then gravityNormal = -totalNormal stickTimer = 0.75 elseif stickTimer > 0 and workspace:Raycast(root.Position, gravityNormal * 8, rcParams) then stickTimer = stickTimer - dt else gravityNormal = -Vector3.yAxis stickTimer = 0 end --update visual wheel local visualWheel = character:FindFirstChild("VisualWheel") if not visualWheel then return end local visualFX = character:FindFirstChild("VisualFX") local orient = visualWheel.AlignOrientation if root.AssemblyLinearVelocity.Magnitude >= 0.01 then lastDirection = root.AssemblyLinearVelocity local cf = CFrame.lookAt(Vector3.new(), root.AssemblyLinearVelocity, -gravityNormal) if visualFX then visualFX.AlignOrientation.PrimaryAxis = cf.XVector visualFX.AlignOrientation.SecondaryAxis = cf.YVector visualFX:PivotTo(cf + root.CFrame.Position) end local twist = twistAngle(root.CFrame, cf.XVector) cf = cf * CFrame.Angles(twist, 0, 0) orient.PrimaryAxis = cf.ZVector orient.SecondaryAxis = cf.YVector visualWheel:PivotTo(cf + root.CFrame.Position) end end local wheel = character:FindFirstChild("Wheel") if wheel then local antigravity = wheel:FindFirstChild("Antigravity") if antigravity then antigravity.Force = gravityNormal*wheel.AssemblyMass*workspace.Gravity + Vector3.new(0, wheel.AssemblyMass * workspace.Gravity, 0) end end end) local function onCharacterAdded(character) for _, conn in pairs(playerConns) do conn:Disconnect() end rcParams.FilterDescendantsInstances = {character} playerConns = { character.DescendantAdded:Connect(function(descendant) if descendant.Name == "VisualWheel" then local root = character:FindFirstChild("HumanoidRootPart") if not root then return end local orient = descendant:WaitForChild("AlignOrientation") local cf = CFrame.lookAt(Vector3.zero, root.CFrame.LookVector) local twist = twistAngle(root.CFrame, cf.XVector) cf = cf * CFrame.Angles(twist, 0, 0) orient.PrimaryAxis = cf.ZVector orient.SecondaryAxis = cf.YVector descendant:PivotTo(cf + root.CFrame.Position) end end), character:GetAttributeChangedSignal("Rolling"):Connect(function() if character:GetAttribute("Rolling") then local root = character:FindFirstChild("HumanoidRootPart") if not root then return end game.Workspace.CurrentCamera.CameraSubject = root else local human = character:FindFirstChildOfClass("Humanoid") local root = character:FindFirstChild("HumanoidRootPart") if not root or not human then return end game.Workspace.CurrentCamera.CameraSubject = human root.CFrame = CFrame.new(root.CFrame.Position) * CFrame.lookAt(Vector3.zero, lastDirection) end end) } end game.Players.LocalPlayer.CharacterAdded:Connect(onCharacterAdded) onCharacterAdded(game.Players.LocalPlayer.Character) UserInputService.InputBegan:Connect(function(input, gameProcessedEvent) if gameProcessedEvent then return end if input.KeyCode == Enum.KeyCode.R then remoteToggleRolling:FireServer() elseif input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.Up then up = true updateMoveVector() elseif input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.Down then down = true updateMoveVector() elseif input.KeyCode == Enum.KeyCode.A then left = true updateMoveVector() elseif input.KeyCode == Enum.KeyCode.D then right = true updateMoveVector() end end) UserInputService.InputEnded:Connect(function(input, gameProcessedEvent) if gameProcessedEvent then return end if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.Up then up = false updateMoveVector() elseif input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.Down then down = false updateMoveVector() elseif input.KeyCode == Enum.KeyCode.A then left = false updateMoveVector() elseif input.KeyCode == Enum.KeyCode.D then right = false updateMoveVector() end end) UserInputService.JumpRequest:Connect(function() local character = game.Players.LocalPlayer.Character if character and character:GetAttribute("Rolling") then local root = character:FindFirstChild("HumanoidRootPart") if not root then return end if coyote > 0 then coyote = 0 root:ApplyImpulse( (jumpNormal*60 - (jumpNormal * jumpNormal:Dot(root.AssemblyLinearVelocity))) * root.AssemblyMass ) end end end)]=], gui)